import request from '@/utils/request'

// 分页查询
export const GetSysUserListByPage = (pageNum, pageSize, queryDto) => {
    return request({
        url: '/admin/system/sysUser/findByPage/' + pageNum + '/' + pageSize,
        method: 'get',
        params: queryDto,
    })
}

// 新增用户的方法
export const SaveSysUser = data => {
    return request({
        url: '/admin/system/sysUser/saveSysUser',
        method: 'post',
        data: data,
    })
}

// 修改用户数据的方法
export const UpdateSysUser = sysUser => {
    return request({
        url: '/admin/system/sysUser/updateSysUser',
        method: 'put',
        data: sysUser,
    })
}

// 根据id删除用户
export const DeleteSysUserById = userId => {
    return request({
        url: '/admin/system/sysUser/deleteById/' + userId,
        method: 'delete',
    })
}

// 给用户分配角色请求
export const DoAssignRoleToUser = assginRoleVo => {
    return request({
        url: '/admin/system/sysUser/doAssign',
        method: 'post',
        data: assginRoleVo,
    })
}

//跟新用户状态
export const UpdateSysUserStatus = (userId, status) => {
    return request({
        url: '/admin/system/sysUser/updateStatus/' + userId + '/' + status,
        method: 'put',
    })
}

export const UpdateUserAvatar = (userId, avatar, token) => {
    console.log(userId, avatar, token)
    return request({
        url: '/admin/system/sysUser/updateAvatar/' + userId,
        method: 'put',
        data: {
            avatar: avatar,
            token: token
        }
    })
}
export const UpdateMobile = (username, mobile, code, token) => {
    return request({
        url: '/admin/system/sysUser/updateMobile/' + username,
        method: 'put',
        data: {
            mobile: mobile,
            code: code,
            token: token
        }
    })
}


export const SendVerificationCode = mobile => {
    return request({
        url: '/admin/system/sms/sendCode/' + mobile,
        method: 'get',
    })
}
